package com.hhd.pojo;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class UserProxy {
    @Pointcut(value = "execution(* com.hhd.pojo.User.add(..))")
    public void Pointcut(){

    }

    @Before(value = "Pointcut()")
    @Order(3)
    public void before() {//前置通知
        System.out.println("before......");
    }



    @Around(value = "execution(* com.hhd.pojo.User.add(..))")
    public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
        System.out.println("环绕之前....");
        proceedingJoinPoint.proceed();
        System.out.println("环绕之后....");
    }
    @After(value = "execution(* com.hhd.pojo.User.add(..))")
    public void after(){
        System.out.println("after....");
    }

    @AfterThrowing(value = "execution(* com.hhd.pojo.User.add(..))")
    public void afterThrowing(){
        System.out.println("afterThrowing....");
    }

    @AfterReturning(value = "execution(* com.hhd.pojo.User.add(..))")
    public void afterReturning(){
        System.out.println("afterReturning....");
    }

}
